#include <Engine.hpp>
#include <iostream>

inline int run(u32 argc, char const *argv[]) {
    //    std::locale::global(std::locale(""));
    std::vector<std::string> args{};
    for (uint32_t i = 0; i < argc; i++) {
        args.emplace_back(argv[i]);
    }
    return NaturalEngine::Engine::Run(args);
}

#ifdef  _WIN32

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
    char *lines = GetCommandLine();
    std::vector<char const *> argv;
    char *context = nullptr;
    char *token = strtok_s(lines, " ", &context);
    while (token != nullptr) {
        argv.push_back(token);
        token = strtok_s(nullptr, " ", &context);
    }
    return run(argv.size(), argv.data());
}

#else
int main(int argc, char const* argv[]) {
 return run(argc, argv);
}
#endif
